Skip to content

fix(og): decode xml tags in og images#1923

Open
WarningImHack3r wants to merge 1 commit intosveltejs:mainfrom
WarningImHack3r:decode-xml-in-og
Open

fix(og): decode xml tags in og images#1923
WarningImHack3r wants to merge 1 commit intosveltejs:mainfrom
WarningImHack3r:decode-xml-in-og

Conversation

@WarningImHack3r
Copy link
Copy Markdown
Contributor

@WarningImHack3r WarningImHack3r commented Apr 9, 2026

Fix OG images containing <s (among others) displaying text with escaped characters (&lt;).

This fix is taken directly (and adapted) from the code I wrote in Svelte Changelog (here then here), as we use the same core logic and I encountered the exact same issue. :D

image image
Before (svelte.dev) After (localhost)

Notes on the code

  • I took advantage of the existing escape.js file to add in my (opposite) logic, which is exactly made for this purpose (lucky me!). In the existing code, I lifted the regex out of the function so it can be computed only once, and made it dynamic so that everything derives from the single existing record. I also added more characters to the record. Finally, I added a null check to the existing function to avoid any problem, even though it'll very likely never be used!
  • I duplicated the vnode logic to both the OG image generators, as a bunch of the logic is already duplicated between both, and I don't really know where to put it anyway; it's very dependent on the very computing code in the core of the generators. Let me know if you have any suggestions!

Note

The CI lint step fails because of the same problem existing on master, I can't do much about it :(

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

@WarningImHack3r is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

WarningImHack3r added a commit to WarningImHack3r/svelte-changelog that referenced this pull request Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant